<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="app">

  </div>
  <script src="../utils/js/old_version/react.development.js"></script>
  <script src="../utils/js/old_version/react-dom.development.js"></script>
  <script src="../utils/js/old_version/babel.min.js"></script>
  <script type="text/babel">
    class Weather extends React.Component {
      // 类里面直接写赋值语句，表示将一个属性以及属性值直接挂载到实例对象上
      state = {isHot: false}
      render() {
        return <h1 onClick={this.changeWeather}>今天天气{this.state.isHot ? "炎热" : "凉快"}</h1>
      }
      // 将方法直接挂载到实例对象上，而不是对象的原型上
      changeWeather = () => {
        console.log(this);  
        const isHot = this.state.isHot;
        this.setState({isHot: !isHot})
      }
    }
    ReactDOM.render(<Weather />,document.getElementById("app"))
  </script>
</body>
</html>